cmd: replace the cast of the memory access to a fixed bit type in itest
authorKunihiko Hayashi <[email protected]>
Wed, 4 May 2016 05:20:04 +0000 (14:20 +0900)
committerTom Rini <[email protected]>
Fri, 27 May 2016 14:01:07 +0000 (10:01 -0400)
This patch fixes a bug that long word(.l) memory access in 'itest'
command reads the 8bytes of the actual memory on 64-bit architecture.
The cast to the memory pointer should use a fixed bit type.

Signed-off-by: Kunihiko Hayashi <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Stefan Roese <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
cmd/itest.c

index fb4d797e43d78b56b4a466a7d086bfcdb20cdf14..60626c7fe9c3d983d247aeee6f89b76548a189b5 100644 (file)
@@ -65,13 +65,13 @@ static long evalexp(char *s, int w)
                }
                switch (w) {
                case 1:
-                       l = (long)(*(unsigned char *)buf);
+                       l = (long)(*(u8 *)buf);
                        break;
                case 2:
-                       l = (long)(*(unsigned short *)buf);
+                       l = (long)(*(u16 *)buf);
                        break;
                case 4:
-                       l = (long)(*(unsigned long *)buf);
+                       l = (long)(*(u32 *)buf);
                        break;
                }
                unmap_physmem(buf, w);